<!DOCTYPE html>
<html>

<head>
    <title>资源管理</title>
</head>

<body>

<div class="page-header">
    <h1>${_resource_name!''}
        <small><i class="ace-icon fa fa-angle-double-right"></i>
            资源列表
        </small>
    </h1>
</div><!-- /.page-header -->

<div class="row">
    <div class="col-xs-12">
        <!-- PAGE CONTENT BEGINS -->
        <!-- button 区域 -->
        <@shiro.hasPermission name="${ctlKey}:add">
        <@tbHeaderBtn l="add" />
        </@shiro.hasPermission>
        <div class="hr hr-18 dotted hr-double"></div>
        <!-- PAGE CONTENT BEGINS -->
        <div class="col-xs-12">
            <!-- PAGE CONTENT BEGINS -->
            <table id="simple-table" class="table table-striped table-bordered table-hover">
                <thead>
                <tr>
                    <th class="center" width="10%">ID</th>
                    <th class="center" width="15%">资源名</th>
                    <th class="center" width="15%">类型</th>
                    <th class="center hidden-480" width="30%">标识</th>
                    <th class="center" width="5%">类型</th>
                </tr>
                </thead>

                <tbody>
                <#list tree as r>
                    <tr>
                        <td class="center">${r.id}</td>
                        <td>${r.resourceName}</td>
                        <td class="center">${r.type}</td>
                        <td class="hidden-480">${r.permission!}</td>
                        <td class="center">
                            <div class="hidden-sm hidden-xs btn-group">
                                <@shiro.hasPermission name="${ctlKey}:edit">
                                    <a class="btn btn-xs btn-info" href="${ctlKey}/edit/${r.id}"><i class="ace-icon fa fa-pencil bigger-120"></i></a>
                                </@shiro.hasPermission>
                                <@shiro.hasPermission name="${ctlKey}:delete">
                                    <a class="btn btn-xs btn-danger" onclick="delRow(${r.id})"><i class="ace-icon fa fa-trash-o bigger-120"></i></a>
                                </@shiro.hasPermission>
                            </div>
                            <div class="hidden-md hidden-lg">
                                <div class="inline pos-rel">
                                    <button class="btn btn-minier btn-primary dropdown-toggle" data-toggle="dropdown" data-position="auto">
                                        <i class="ace-icon fa fa-cog icon-only bigger-110"></i>
                                    </button>
                                    <ul class="dropdown-menu dropdown-only-icon dropdown-yellow dropdown-menu-right dropdown-caret dropdown-close">
                                        <@shiro.hasPermission name="${ctlKey}:edit">
                                            <li><a href="${ctlKey}/edit/${r.id}" class="tooltip-success" data-rel="tooltip" title="Edit"> <span class="green"> <i class="ace-icon fa fa-pencil-square-o bigger-120"></i></span></a></li>
                                        </@shiro.hasPermission>
                                        <@shiro.hasPermission name="${ctlKey}:delete">
                                            <li><a onclick="delRow(${r.id})" class="tooltip-error" data-rel="tooltip" title="Delete"> <span class="red"> <i class="ace-icon fa fa-trash-o bigger-120"></i></span></a></li>
                                        </@shiro.hasPermission>
                                    </ul>
                                </div>
                            </div>
                        </td>
                    </tr>
                    <@tableTree resource=r level=1/>
                </#list>
                </tbody>
            </table>
        <!-- PAGE CONTENT ENDS -->
    </div><!-- /.col -->
</div><!-- /.row -->
</body>
<my_script>
    <!-- inline scripts related to this page -->
    <script src="/assets/js/jquery.serializejson.js"></script>
    <script src="/assets/js/jquery.dataTables.min.js"></script>
    <script src="/assets/js/jquery.dataTables.bootstrap.min.js"></script>
    <script src="/common/js/jquery.dataTables.default.js"></script>
    <script type="text/javascript">
    </script>
</my_script>

</html>
<#macro tableTree resource level>
    <#if resource.childsResourceList?? && (resource.childsResourceList?size>0)>
        <#list resource.childsResourceList as r>
            <tr>
                <td class="center">${r.id}</td>
                <td>
                    <i class="col-sm-${level}"></i>
                    ${r.resourceName}
                </td>
                <td class="center">${r.type}</td>
                <td class="hidden-480">${r.permission!}</td>
                <td class="center">
                    <div class="hidden-sm hidden-xs btn-group">
                        <#--	<#if USER.hasPermission("${ctlKey}:edit")>-->
                        <a class="btn btn-xs btn-info" href="${ctlKey}/edit/${r.id}"><i class="ace-icon fa fa-pencil bigger-120"></i></a>
                        <#--    </#if>-->
                        <#--    <#if USER.hasPermission("${ctlKey}:delete")>-->
                        <a class="btn btn-xs btn-danger" onclick="delRow(${r.id})"><i class="ace-icon fa fa-trash-o bigger-120"></i></a>
                        <#--    </#if>-->
                    </div>
                    <div class="hidden-md hidden-lg">
                        <div class="inline pos-rel">
                            <button class="btn btn-minier btn-primary dropdown-toggle" data-toggle="dropdown" data-position="auto">
                                <i class="ace-icon fa fa-cog icon-only bigger-110"></i>
                            </button>
                            <ul class="dropdown-menu dropdown-only-icon dropdown-yellow dropdown-menu-right dropdown-caret dropdown-close">
                                <#--			<#if USER.hasPermission("${ctlKey}:edit")>-->
                                <li><a href="${ctlKey}/edit/${r.id}" class="tooltip-success" data-rel="tooltip" title="Edit"> <span class="green"> <i class="ace-icon fa fa-pencil-square-o bigger-120"></i></span></a></li>
                                <#--            </#if>-->
                                <#--            <#if USER.hasPermission("${ctlKey}:delete")>-->
                                <li><a onclick="delRow(${r.id})" class="tooltip-error" data-rel="tooltip" title="Delete"> <span class="red"> <i class="ace-icon fa fa-trash-o bigger-120"></i></span></a></li>
                                <#--            </#if>-->
                            </ul>
                        </div>
                    </div>
                </td>
            </tr>
            <@tableTree resource=r level=level+1/>
        </#list>
    </#if>
</#macro>